import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: mirac
 * Date: 2025-10-23
 * Time: 22:53
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()) {
            String input = scanner.nextLine();
            String output = scanner.nextLine();

            input = input.toUpperCase();   //实际输入
            output = output.toUpperCase(); //实际输出

            //将实际输出存起来
            Set<Character> set1 = new HashSet<>();
            for (int i = 0; i < output.length(); i++) {
                if (!set1.contains(output.charAt(i))) {
                    set1.add(output.charAt(i));
                }
            }

            //将实际输出与输入进行比较，确定坏掉的键
            Set<Character> set2 = new HashSet<>();  //用来储存已经打印的坏键，防止重复输出！
            for (int i = 0; i < input.length(); i++) {
                if (!set1.contains(input.charAt(i))
                        && !set2.contains(input.charAt(i)) ) {
                    System.out.print(input.charAt(i));
                    set2.add(input.charAt(i));
                }
            }
            System.out.println();
        }
    }
}
